	
			<!-- 判断表单是否发生过更改的token -->
			<input type="hidden" id="form_token" value="1"/>
			<!-- 乐观锁控制 -->
			<input type="hidden" id="_#(version??'version')" name="#(table??).#(version??'version')" value="">
			
			#if(isEmpty(keys))
				<input type="hidden" id="_#(key??'id')" name="#(table??).#(key??'id')" value=""/>
			#else
				#for(k : keys)
					<input type="hidden" id="#(k.table??)_#(k.key??'id')" name="#(k.table??).#(k.key??'id')" value=""/>
				#end
			#end
			#for(y : col)
			  <div class="form-group" style="display:#(display??)">
			      #for(x : y)
			          #if(!isEmpty(x.title))
						<div class="page-header-form">
							<h2>
								#(x.title??)
								#if(!isEmpty(x.small))
									<small>
										<i class="fa fa-angle-double-right">
											#(x.small??)
										</i>
									</small>
								#end
							</h2>
						
						</div>
				   #else
				        #setLocal(display = (like(x.type,"hidden")) ? "none" : "block")
				        #setLocal(placeholder = (!isEmpty(x.placeholder)) ? x.placeholder : ("暂无"+x.name))
								<label class="col-sm-#(x.labellen??2) control-label no-padding-right" > #(x.name??) </label>			
								<div class="col-sm-#(x.length??3)">
					            #if(x.type=="text"||x.type=="number"||x.type=="tel"||x.type=="email"||x.type=="url"||x.type=="qq"||x.type=="unionpay"||x.type=="credit"||x.type=="idcard")
									<input type="#(x.type??'text')" id="_#(x.index??)" name="#(table??x.table).#(x.index??)" #(x.required??) #(x.disabled??) #(x.readonly??) value="#(x.value??)" placeholder="#(placeholder??)" class="form-control" autocomplete="off"/>
								#else if(x.type=="double")
									<input type="#(x.type??'text')" id="_#(x.index??)" name="#(table??x.table).#(x.index??)" #(x.required??) #(x.disabled??) #(x.readonly??) value="#(x.value??)" placeholder="#(placeholder??)" class="form-control" autocomplete="off"/>
	                    	    #else if(like(x.type,"hidden"))
									<input type="#(x.type??'hidden')" id="_#(x.index??)" name="#(table??x.table).#(x.index??)"  value="#(x.value??)" class="form-control" />
								#else if(x.type=="textarea")
									<textarea id="_#(x.index??)" style="height:#(x.height??'200px')" name="#(table??x.table).#(x.index??)" #(x.required??) #(x.disabled??) #(x.readonly??) value="#(x.value??)" placeholder="#(placeholder??)" class="form-control"></textarea>
								#else if(x.type=="image")
									<img id="_#(x.index??)" data-type="image" data-auto="#(x.auto??)" style="padding:2px; border:1px solid #ccc;cursor:pointer;width:#(x.width??'168px');height:#(x.height??'110px');" name="#(table??x.table).#(x.index??)" src="#(x.src??)"></img>
								#else if(like(x.type,"select_"))
								    #setLocal(num = getNumByType(x.type,"select_",""))
								    #select("dict",num,table+"."+x.index,x.value??'',x.tail??,x.required??'')
								#else if(like(x.type,"combo_"))
								    #setLocal(num = getNumByType(x.type,"combo_",""))
								    #@combo(x,num,placeholder)
								#else if(like(x.type,"dropdown_"))
									#setLocal(num = getNumByType(x.type,"dropdown_",""))
									#dropDown("dict",num,table+"."+x.index,x.value??0,x.tail??,x.required??'')
								#else if(x.type=="kindeditor")
								 	#@kindeditor(x)
								#else if(x.type=="ueditor")
									#@ueditor(x)
								#else if(x.type=="selectDiy")
								    #select("diy","",table+"."+x.index,x.value??'',x.tail??,x.required??'',x.source??,x.where??'')
								#else if(x.type=="dropdownDiy")
								    #dropDown("diy","",table+"."+x.index,x.value??0,x.tail??,x.required??'',x.source??,x.where??)
								#else if(x.type=="selectDept")
								 	#select("dept","",table+"."+x.index,x.value??'',x.tail??,x.required??'',"",x.where??'')
								#else if(x.type=="selectcascade")
								     #@selectEdit(x,placeholder)
								#else if(x.type=="dropdownDept")
								    #dropDown("dept","",table+"."+x.index,x.value??'',x.tail??,x.required??'',"")
								#else if(x.type=="selectRole")
								    #select("role","",table+"."+x.index,x.value??'',x.tail??,x.required??'',"",x.where??'')
								#else if(x.type=="selectStatic")
							    	#select("static","",table+"."+x.index,x.value??'',x.tail??,x.required??'',x.source??'',"")
								#else if(x.type=="dropdownRole")
								    #dropDown("role","",table+"."+x.index,x.value??0,x.tail??,x.required??'',"")
								#else if(x.type=="selectUser")
								    #select("user","",table+"."+x.index,x.value??'',x.tail??,x.required??'',"",x.where??'')
								#else if(x.type=="dropdownUser")
								    #dropDown("user","",table+"."+x.index,x.value??0,x.tail??,x.required??'',"")
								#else if(x.type=="checkbox")
									#@checkbox(x)
								#else if(x.type=="checkbox2")
									#@checkbox2(x)
								#else if(x.type=="radios")
									#@radios(x)
								#else if(x.type=="date")
									#@date(x)
								#else if(x.type=="laydate")
									#@laydate(x)
								#else if(x.type=="imgupload")
									#@imgupload(x)
								#else if(x.type=="multiimgupload")
								    #@multiimgupload(x)
								#else if(x.type=="fileupload")
									#@fileupload(x)
								#else if(x.type=="uploadify")
							    	#@uploadify()
							    #else if(x.type=="upload")
							        #@upload(x)
								#else if(like(x.type,"opentree"))
									#@opentree(x,placeholder)
							    #else if(like(x.type,"selecttree"))
									#@selecttree(x,placeholder)
								#else if(x.type=="span")
									  #@span(x)
								#else
									<input type="text" id="_#(x.index??)" name="#(table??x.table).#(x.index??)" #(x.required??) #(x.disabled??) value="#(x.value??)" placeholder="#(placeholder??)" class="form-control" />
					            #end
								</div>
					#end
			      #end
			  </div>
			#end
			
		<script	type="text/javascript">
			$(function(){
				var _model = #(model??"'error'");
				if(_model == "error"){
					layer.msg('读取数据失败!', {icon: 5});
					return;
				}
				for(var x in _model){
					var $x = $("#_" + x);
					if($x.is("input") || $x.is("textarea")){
						$x.bind("focus", function(){
							var _name = $(this).attr("name").replace("token_", "");
							$(this).attr("name", _name);
							$("#form_token").val(1);
						});
					}
					
					if(_model[x] != null && $x.attr("data-type") == "image"){
						var src = $("#_"+x).attr("data-auto") + _model[x];
						$x.attr("src",src);
						$x.bind("click",function(){
							window.open($(this).attr("src"));
						});
					}
					else if(_model[x] != null && $x.attr("data-type") == "imgupload"){
						var id = _model[x];
						$x.val(id);
						var functionName = "_"+x+"_initImgUpload";
						eval(functionName+"(id,'edit');");
					}
					else if(_model[x] != null && $x.attr("data-type") == "multiimgupload"){
						var id = _model[x];
						$x.val(id);
						var functionName = "_"+x+"_initMultiImgUpload";
						eval(functionName+"(id,'edit');");
					}
					else if(_model[x] != null && $x.attr("data-type") == "upload"){
						var id = _model[x];
						$x.val(id);
						var functionName = "_"+x+"_inituploadview";
						eval(functionName+"(id,'edit');");
					}
					else if($x.attr("data-type") == "selectEdit"){
						var id = _model[x];
						var functionName = "_"+x+"_initSelect";
						eval(functionName+"(id,'edit');");
					}
					else if($x.attr("data-type") == "cascade"){
						var id = _model[x];
						$x.val(id);
						var functionName = "_"+x+"_initcascade";
						eval(functionName+"();");
					}
					else if(_model[x] != null && $x.attr("data-type") == "fileupload"){
						var ids = _model[x];
						$x.val(ids);
						var functionName = "_"+x+"_initFileUpload";
						eval(functionName+"(ids,'edit');");
					}
					else if(_model[x] != null && $x.attr("data-type") == "uploadify"){
						var ids = _model[x];
						$x.val(ids);
						var functionName = "_"+x+"_inituploadifyUpload";
						eval(functionName+"(ids,'edit');");
					}
					else if(_model[x] != null && $x.attr("data-type") == "opentree"){
						var ids = _model[x];
						$x.val(ids);
						var functionName = "_"+x+"_initOpenTree";
						eval(functionName+"(ids);");
					}
					else if(_model[x] != null && $x.attr("data-type") == "selecttree"){
						var ids = _model[x];
						$x.val(ids);
						initSelectTree(ids);
					}
					else if(_model[x] != null && $("#_" + x + "_chb").attr("type") == "checkbox"){
						var value = _model[x];
						$x.val(value);
						var functionName = "_"+x+"_initcheckbox";
						eval(functionName+"(value);");
					}
					else if(_model[x] != null && $x.attr("data-type") == "radios"){
						var _ele = "#_" + x+"_radio"+_model[x]
						$(_ele).attr("checked","checked");
						$x.val(_model[x]);
					}
					else if($x.is("span")){
						/* var _x = _model[x];
						if(_x == null || _x == ""){
							_x = "请选择";
						}
						$x.html(_x); */
						var functionName = "_"+x+"_initSpan";
						eval(functionName+"(_x);");
					}
					else if(_model[x] != null && $x.attr("data-type") == "ueditor"){
						var value = _model[x];
						var functionName = "_"+x+"_initueditor";
						eval(functionName+"(value);");
					}
					else if($x.is("select")&& $x.attr("data-type") != "select"&& $x.attr("data-type") != "selectEdit"){
						var $xText = $("#_"+x+"_ext");
						$x.val(_model[x]);
						var options = $("#_" + x + " option:selected");
						$xText.val(options.text());
					}
					else if(_model[x] != null && $x.attr("data-type") == "laydate"){
						var value = _model[x];
						var functionName = "_"+x+"_initlaydate";
						eval(functionName+"(value);");
					}
					else if(_model[x]!=null && $x.attr("type")=="text"){
						$x.val(_model[x]);
					}else if(_model[x] != null && $x.attr("data-type") == "kindEditor"){
						$x.val(_model[x]);
						var functionName = "_"+x+"_initkindeditor";
						eval(functionName+"();");
					}else{
						if(_model[x]!=null){
							$x.val(_model[x]);
						}
					}
				}
			});
		</script>
			
			
